import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import { clearPending } from "@/api/http";
import Index from "@/views/index/index.vue";

const routes: Array<RouteRecordRaw> = [
   {
      path: "/",
      name: "index",
      component: Index
   }
];

const router = createRouter({
   history: createWebHashHistory(),
   routes,
});

router.beforeEach((to, from, next) => {
   //在跳转路由之前，先清除所有的请求
   clearPending()
   // ...
   next()
})

export default router;
